﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="EmpData.aspx.cs" Inherits="WebForm_EmpData" %>

<%@ Register Src="~/WebForm/EmpData/tabPrimary.ascx" TagName="tabPrimary" TagPrefix="uc" %>
<script runat="server">
    /* list */
    protected void gv_DataBinding(object sender, EventArgs e)
    {
        var db = new DB();
        var dt = db.Execute(string.Format("SELECT e.* FROM EmpData e WHERE e.OrgID IN ({0}) "
            , MyObj.JoinFormat(",", "'{0}'", RoleManager.Current.GetOrgForCurrentComp())));

        LocManager.Current.Translate(dt, "EmpData", "EmpName");

        (sender as DataBoundControl).DataSource = dt;

        mv.SetActiveView(mvList);
    }
    /* end of list */

    /* form */

    /* end of form */
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <asp:MultiView ID="mv" runat="server" ActiveViewIndex="0">
        <asp:View ID="mvList" runat="server">
            <asp:LinkButton ID="btnAdd" runat="server" Text="<%$Resources: Form, btnAdd   %>"
                CommandName="MyInsert" OnClick="btnAdd_Click"></asp:LinkButton>
            <p />
            <My:MyGridView ID="gv" runat="server" OnDataBinding="gv_DataBinding" OnRowCommand="gv_ItemCommand" 
                DataKeyNames="EmpID">
                <Columns>
                    <asp:TemplateField HeaderText="<%$Resources: EmpData, EmpID   %>">
                        <ItemTemplate>
                            <%# Eval("EmpID") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources: EmpData, EmpName   %>">
                        <ItemTemplate>
                            <%# Eval("EmpName") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources: EmpData, NTAccount   %>">
                        <ItemTemplate>
                            <%# Eval("NTAccount")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources: OrgData, OrgName   %>">
                        <ItemTemplate>
                            <%# LocManager.Current.GetText("OrgData", "OrgName", Eval("OrgID")) %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources: WorkGroup, WorkGroupID   %>" Visible="false">
                        <ItemTemplate>
                            <%# LocManager.Current.GetText("WorkGroup", "WorkGroupName", Eval("WorkGroupID"))%>
                        </ItemTemplate>
                    </asp:TemplateField>                    
                    <asp:TemplateField HeaderText="<%$Resources: EmpData, Title   %>" Visible="false">
                        <ItemTemplate>
                            <%# CodeManager.Current.GetText("EmpData", "Title", Eval("Title"))%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources: EmpData, EmpLevel   %>" Visible="false">
                        <ItemTemplate>
                            <%# CodeManager.Current.GetText("EmpData", "EmpLevel", Eval("EmpLevel"))%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$Resources: EmpData, ComeDate   %>" Visible="false">
                        <ItemTemplate>
                            <%# Eval("ComeDate", "{0:d}")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton runat="server" CommandName="MyEdit" Text="<%$Resources: Form, btnEdit %>"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="btnDelete" runat="server" CommandName="MyDelete" Text="<%$Resources: Form, btnDelete %>"></asp:LinkButton>
                            <ajax:ConfirmButtonExtender ID="cbDelete" runat="server" TargetControlID="btnDelete"
                                 ConfirmText="<%$Resources: Form, cbDelete %>"></ajax:ConfirmButtonExtender>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </My:MyGridView>
            <%--            <asp:ListView ID="gv2" runat="server" OnDataBinding="gv_DataBinding">
                <LayoutTemplate>

                    <table class="gv">
                        <thead>
                            <tr>
                                <th>
                                    <asp:Localize ID="Localize1" runat="server" Text="<%$Resources: EmpData, EmpID   %>"></asp:Localize>
                                </th>
                                <th>
                                    <asp:Localize ID="Localize4" runat="server" Text="<%$Resources: EmpData, EmpName   %>"></asp:Localize>
                                </th>
                                <th>
                                    <asp:Localize ID="Localize2" runat="server" Text="<%$Resources: EmpData, Alias   %>"></asp:Localize>
                                </th>
                                <th>
                                    <asp:Localize ID="Localize3" runat="server" Text="<%$Resources: OrgData, OrgName   %>"></asp:Localize>
                                </th>
                                <th>
                                    <asp:Localize ID="Localize5" runat="server" Text="<%$Resources: EmpData, Title   %>"></asp:Localize>
                                </th>
                                <th>
                                    <asp:Localize ID="Localize15" runat="server" Text="<%$Resources: EmpData, ComeDate   %>"></asp:Localize>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <asp:PlaceHolder runat="server" ID="itemPlaceholder" />
                        </tbody>
                    </table>
                </LayoutTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <%# Eval("EmpID") %>
                        </td>
                        <td>
                            <%# Eval("EmpName") %>
                        </td>
                        <td>
                            <%# Eval("Alias") %>
                        </td>
                        <td>
                            <%# LocManager.Current.GetText("OrgData", "OrgName", Eval("OrgID")) %>
                        </td>
                        <td>
                            <%# CodeManager.Current.GetText("EmpData", "Title", Eval("Title"))%>
                        </td>
                        <td>
                            <%# Eval("ComeDate", "{0:d}")%>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:ListView>--%>
        </asp:View>
        <asp:View ID="mvForm" runat="server">
            <asp:LinkButton ID="btnBack" runat="server" Text="<%$Resources: Form, btnBack   %>"
                CommandName="Back" OnClick="btnBack_Click"></asp:LinkButton>
            <p />
            <My:MyFormView ID="fv" runat="server" OnItemCommand="fv_ItemCommand"
                OnSaved="fv_Saved" Width="100%">
                <EditItemTemplate>
                    <ajax:TabContainer ID="tabs" runat="server" OnDemand="true" Width="100%">
                        <ajax:TabPanel ID="tabPrimary" runat="server" HeaderText="<%$Resources: EmpData, tabPrimary %>">
                            <ContentTemplate>
                                <uc:tabPrimary runat="server" />
                            </ContentTemplate>
                        </ajax:TabPanel>
                        <ajax:TabPanel ID="tabIdv" runat="server" HeaderText="<%$Resources: EmpData, tabIdv %>">
                            <ContentTemplate>
                                aa</ContentTemplate>
                        </ajax:TabPanel>
                        <ajax:TabPanel ID="tabSkill" runat="server" HeaderText="<%$Resources: EmpData, tabSkill %>">
                            <ContentTemplate>
                                bb</ContentTemplate>
                        </ajax:TabPanel>
                    </ajax:TabContainer>
                    <p>
                    </p>
                    <asp:Button ID="btnSave" runat="server" CommandName="MySave" Text="<%$Resources: Form, btnSave %>" />
                    <asp:Button ID="btnCancel" runat="server" CommandName="MyCancel" Text="<%$Resources: Form, btnCancel %>" />
                    <ajax:ConfirmButtonExtender runat="server" TargetControlID="btnSave" ConfirmText="<%$Resources: Form, cbSave %>">
                    </ajax:ConfirmButtonExtender>
                </EditItemTemplate>
                <ItemTemplate>
                </ItemTemplate>
            </My:MyFormView>
        </asp:View>
    </asp:MultiView>
</asp:Content>
